public class Main1 {
    public static void main(String[] args) {
     animal a =new cat();
     dog b =new dog();
     a.show();
     b.show();
        System.out.println(a.name);
        System.out.println( b.name);
    }}
class animal{
    String name="动物";
    public void show(){
        System.out.println("animal---show");
    }
}
class cat  extends animal {
    String name="猫";
      public void show(){
          System.out.println("cat----show");
      }
}
class dog  extends  animal{
    String name ="狗";
        public void show(){
            System.out.println("dog----show");
        }
}

